{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from mp_utils import extract_choice\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def extract_choice2():\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "23.076923076923077\n"
     ]
    }
   ],
   "source": [
    "df = pd.read_csv(\"./CMMLU_results/steel_llm_0_shot/results_agronomy.csv\", names=['id','question','A','B','C','D','answer','response'], index_col=0)\n",
    "# To deal with some mismath between data and answer\n",
    "if df.iloc[0]['question'] == '1':\n",
    "    df = df.drop(0)\n",
    "df['pred'] = df['response'].apply(extract_choice)\n",
    "df['acc'] = df['answer'] == df['pred']\n",
    "acc = np.mean(df['acc']) * 100\n",
    "print(acc)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pytorch",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
